package com.lfcsoft.elasticsearch.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * @author liqinwen
 * @date 2021-3-5 10:25
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Document(indexName = "ems")
public class Emp {
    @Id
    private String id;
    //type 用来指定ES中存储数据类型,analyzer 用来指定哪种分词器
    @Field(type = FieldType.Keyword,analyzer = "ik_max_word")
    private String name;
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String intr;
    @Field(type = FieldType.Integer)
    private Integer age;
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String content;
    @Field(type = FieldType.Boolean)
    private Boolean sex;
}